<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <title>SmartTour Admin</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <!-- Le styles -->
    <link href="__PUBLIC__/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <style type="text/css">
      body {
        padding-top: 60px;
        padding-bottom: 40px;
      }
      .sidebar-nav {
        padding: 9px 0;
      }

      @media (max-width: 980px) {
        /* Enable use of floated navbar text */
        .navbar-text.pull-right {
          float: none;
          padding-left: 5px;
          padding-right: 5px;
        }
      }
    </style>
    <link href="__PUBLIC__/bootstrap/css/bootstrap-responsive.min.css" rel="stylesheet">

    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <script src="__PUBLIC__/bootstrap/js/bootstrap.min.js"></script>
	
  </head>

<body>


	
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
				<div class="page-header">
					<h1>
						添加产品 <small>新增产品信息</small>
					</h1>
				</div>
			</div>
		</div>
	</div>
	
	
	<p></p>
	<form action="__URL__/add/" method="post" >
	<div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">

			<div class="span4">
				<div class="control-group">
		            <select name="type_id" id="type_id" >
                    <option value="0" >请选择大类别</option>
					<volist name="big_type" id="vv">
					<option value="{$vv.type_id}" >{$vv.type_name}</option>
					</volist>
                    </select>
                    </div>


					<div class="control-group">
		              <label class="control-label" >商品名称</label>
		              <div class="controls">
		                <input type="text" name="pro_name" >
		                <span class="help-inline"><font class=" text-info"></font></span> </div>
		            </div>

		            <div class="control-group">
		              <label class="control-label" >信息简述</label>
		              <div class="controls">
		                <input type="text" name="pro_detail"  >
		                <span class="help-inline"><font class=" text-info"></font></span> </div>
		            </div>


		            <div class="control-group">
		              <label class="control-label" >进货价格</label>
		              <div class="controls">
		                <input type="text" name="pro_inprice"  >
		                <span class="help-inline"><font class=" text-info"></font></span> </div>
		            </div>

		            <div class="control-group">
		              <label class="control-label" >库存数量</label>
		              <div class="controls">
		                <input value='100' type="text" name="pro_shuliang"  >
		                <span class="help-inline"><font class=" text-info"></font></span> </div>
		            </div>
			</div>

			<div class="span8">
			 <div class="span6">

              <div class="suggestionsBox" id="suggestions" style="display: none;">
                <div class="suggestionList" id="autoSuggestionsList"> </div>
              </div>
              <div class="control-group">
                <label class="control-label" ></label>

		            <div class="control-group">
		              <label class="control-label" >上传图片</label>
		              <div class="controls">
                  <input type="file" id="file1" name="pro_img" size="30" value="" />
                  <input type="button" value="上传" class="btn" onclick="return ajaxFileUpload();" />
                  <span id="msg" style="display:none" >UpLoading...</span>  
                  <span class="help-inline"><font class=" text-info">为保障图片质量，请上传210*210像素图片</font></span>
		                </div>
		            </div>


                 <div class="control-group">
		              <label class="control-label" >卖出价格</label>
		              <div class="controls">
		                <input type="text" name="pro_selprice"  >
		                <span class="help-inline"><font class=" text-info"></font></span> </div>
		            </div>

		            <div class="control-group">
		              <label class="control-label" >优惠价</label>
		              <div class="controls">
		                <input type="text" name="pro_batprice"  >
		                <span class="help-inline"><font class=" text-info"></font></span> </div>
		            </div>


                <input type="hidden"  name="pro_admin"  value="<?php echo $_SESSION[C('USER_AUTH_KEY')]; ?>">
		            <div class="control-group">
		              <div class="controls"><a class="btn btn-success" href="__APP__/Admin">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;返回&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</a>
		                <button type="submit" class="btn btn-primary">保存编辑</button>
		              </div>
		            </div>

              </div>
              </div>
              <div class="span6">
                <img alt="210x210" id='id_logoimg' src="http://img7.9158.com/200708/10/09/18/200708103758836.jpg"  style="widht:210px;height:210px" />
                <input type="hidden" id="img_URL" name="pro_img" class="span3" value="">
              </div>
			</div>

			</div>
		</div>
	</div>
	</form>

<!--/span-->
</body>


<script src="__PUBLIC__/js/jquery.form.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ajaxfileupload.js"></script>
<script type="text/javascript">
// 上传图片
var str = '';
function ajaxFileUpload(){ 
if(document.getElementById('file1').value=='' || document.getElementById('file1').value==null){
	alert("请选择文件");
	return false;
	}
  $("#msg")
  .ajaxStart(function(){
    $(this).show();
  });
                   
  $.ajaxFileUpload({
    url:'__APP__/Admin/Manage/UploadImg',
    secureuri:false,
    fileElementId:'file1',
    dataType: 'text',
    //data:{name:'qinmi', id:'123'},
    success: function(data){
      if(data=='error'){
        $('#msg').html("<span style='color:red'>上传失败</span>");
      }else{
        $('#msg').html("<span style='color:green'>上传成功</span>");
        str +=  data;
        // alert(str);
        $('#img_URL').val(str);
        $('#id_logoimg').attr('src',"__ROOT__/Index/Public/Imgs/Products/m_"+str);
      }
    }
  }
);
return false;
}
</script>
</html>